home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / jedit42install.exe / {app} / jedit.jar / bsh / commands / load.bsh < prev    next >
Encoding:
Text File  |  2003-12-27  |  480 b   |  23 lines

  1. /**
  2.     Load a serialized Java object from filename.  Returns the object.
  3. */
  4.  
  5. bsh.help.load = "usage: load(filename)";
  6.  
  7. Object load( String filename ) 
  8. {
  9.     this.file = pathToFile( filename );
  10.  
  11.     Object obj;
  12.     FileInputStream in = new FileInputStream( file );
  13.     ObjectInputStream oin = new ObjectInputStream(in);
  14.     obj = oin.readObject();
  15.     oin.close();
  16.  
  17.     // bind bsh objects into the caller's namespace
  18.     if ( obj instanceof bsh.This )
  19.         bind( obj, this.caller.namespace );
  20.  
  21.     return obj;
  22. }
  23.